/**
 * Created by oneminute on 7/17/14.
 */

var lz = require("../lib/utils/modules")();

exports.post = function (_req, _res, _opts, _callback) {
    var user = _req.user;
    if (!user) {
        _callback(lz.Config.errors.getError(lz.Config.errors.REQUEST_TEMPUSER_ERROR));
        return;
    }

    user.lat = _opts.lat;
    user.lon = _opts.lon;
    user.inbusiness = _opts.inbusiness;
    user.phone = _opts.phone;
    user.address = _opts.address;
    user.description = _opts.description;
    user.save({saveAll: false}, function (_err, _user) {
        if (_err) {
            _callback(_err, null);
        } else {
            _callback(null, _user);
        }
    });
};